import request from '@/config/axios'
//获取网格全列表
export const getGridList = async () => {
  return await request.get({ url: '/countryside/dv_affairs/grid_area_manage/list-all-simple' })
}
//获取网格分页
export const getGridPage = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/grid_area_manage/page', data })
}
//创建网格
export const createGrid = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/grid_area_manage/create', data })
}
//更新网格
export const updateGrid = async (data) => {
  return await request.put({ url: '/countryside/dv_affairs/grid_area_manage/update', data })
}
//删除网格
export const deleteGrid = async (id) => {
  return await request.delete({ url: '/countryside/dv_affairs/grid_area_manage/delete?id=' + id })
}
//查询网格名称
export const searchGrid = async (params) => {
  return await request.get({ url: '/countryside/dv_affairs/grid_area_manage/get', params })
}

//审核居民信息
export const getGridmemberInfo = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/grid_member_manage/audit', data })
}
//获取网格员全列表
export const getGridmember = async () => {
  return await request.get({ url: '/countryside/dv_affairs/grid_member_manage/list-all-simple' })
}
//获取网格员分页
export const getGridmemberPage = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/grid_member_manage/page', data })
}
//创建网格员
export const createGridmember = async (data, id) => {
  return await request.post({
    url: `/countryside/dv_affairs/grid_member_manage/create?id=${id}`,
    data
  })
}
//更新网格员
export const updateGridmember = async (data) => {
  return await request.put({ url: '/countryside/dv_affairs/grid_member_manage/update', data })
}
//删除网格员
export const deleteGridmember = async (id) => {
  return await request.delete({ url: '/countryside/dv_affairs/grid_member_manage/delete?id=' + id })
}
//批量删除网格员
export const deleteGridmemberList = async (ids) => {
  return await request.delete({
    url: `/countryside/dv_affairs/grid_member_manage/delete_batch`,
    params: {
      ids: ids.join(',')
    }
  })
}

//获取房屋全列表
export const getHouse = async () => {
  return await request.get({ url: '/countryside/housing_manage/list-all-simple' })
}
//获取房屋分页
export const getHousePage = async (data) => {
  return await request.post({ url: '/countryside/housing_manage/page', data })
}
//创建房屋
export const createHouse = async (data) => {
  return await request.post({ url: '/countryside/housing_manage/create', data })
}
//获取房屋详情
export const getHousedetail = async (id) => {
  return await request.get({ url: '/countryside/housing_manage/get?id=' + id })
}
//更新房屋
export const updateHouse = async (data) => {
  return await request.put({ url: '/countryside/housing_manage/update', data })
}
//批量删除房屋
export const deleteHouseList = async (ids) => {
  return await request.delete({
    url: `/countryside/housing_manage/delete`,
    params: {
      ids: ids.join(',')
    }
  })
}

//审核居民信息
export const getResidentInfo = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/resident_record/audit', data })
}
//获取居民全列表
export const getResident = async () => {
  return await request.get({ url: '/countryside/dv_affairs/resident_record/list-all-simple' })
}
//获得居民查询记录分页
export const getResidentPage = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/resident_record/page', data })
}
//批量导入居民
export const importResidentList = async (formData) => {
  return await request.upload({
    url: `/countryside/dv_affairs/resident_record/import`,
    data: formData
  })
}
//创建居民
export const createResident = async (data) => {
  return await request.post({ url: '/countryside/dv_affairs/resident_record/create', data })
}
//更新居民
export const updateResident = async (data) => {
  return await request.put({ url: '/countryside/dv_affairs/resident_record/update', data })
}
//获取居民详情
export const getResidentdetail = async (id) => {
  return await request.get({ url: '/countryside/dv_affairs/resident_record/get?id=' + id })
}
//下载模版  获得居民档案导入模板
export const downloadResident = async () => {
  return await request.download({
    url: '/countryside/dv_affairs/resident_record/get-import-template'
  })
}
//批量导出居民
export const exportResidentList = async (params) => {
  return await request.download({ url: '/countryside/dv_affairs/resident_record/export', params })
}
//批量删除居民
export const deleteResidentList = async (ids) => {
  return await request.delete({
    url: `/countryside/dv_affairs/resident_record/delete_batch`,
    params: {
      ids: ids.join(',')
    }
  })
}
//删除居民
export const deleteResident = async (id) => {
  return await request.delete({ url: '/countryside/dv_affairs/resident_record/delete?id=' + id })
}

//获取所有户主
export const getHolder = async () => {
  return await request.post({ url: '/countryside/dv_affairs/resident_record/houseHoldList' })
}
